package com.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class BaseFragment extends Fragment {

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		initViews();
		initComponents();
		addListener();
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		super.onCreateView(inflater, container, savedInstanceState);
		View v = inflater.inflate(initLayout(), container,
				false);
		return v;
	}
	protected abstract void initViews();
	protected abstract void initComponents();
	protected abstract void addListener();
	protected abstract int initLayout();

	@Override
	public void onDestroyView() {
		((ViewGroup) getView().getParent()).removeView(getView());
		super.onDestroyView();
	}
}
